<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<link rel="Stylesheet" type="text/css"
	href="<c:url value="/static/css/jquery.ui.css"/>" />
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/js/common.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/js/Loading.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/js/showMsg.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/listBox/jquery.clever.listbox.js"/>"></script>

<script>
	var dataLeft;

	function initList(listDisplayEId) {
		$('#' + listDisplayEId).datagrid({
			nowrap : false,
			striped : true,
			collapsible : true,
			remoteSort : true,
			notSelectByRow : false,
			onLoadError : function() {
				$.messager.alert('错误', '获取数据失败，请与管理员联系！', 'error');
			}
		});
	};
	
	function excel() {
		$('#AddFoodForm').form('submit', {
			url : '<c:url value='/supplier/importSupMaterValueCost.do'/>',
			onSubmit : function()//提交按钮相应函数
			{
				return $('#AddFoodForm').form('validate');
			},
			success : function(data) {
				data = eval('(' + data + ')');
				var msgsuccess = data.success + "";
				if (data.success) {
					Loading.Hide();
					$.messager.alert('系统提示', '导入成功', 'info', function() {
						window.close();
					});
				} else {
					var message = "";
					if (data.msg == "msg001") {
						message = "文件不能为空，请选择文件。";
					} else if (data.msg == "msg002") {
						message = "表格内容不正确，没有填写每单位价格。";
					} else if (data.msg == "msg003") {
						message = "日期格式不正确请按照  yyyy-MM-dd 来填写，并保证长度为10位。";
					} else if (data.msg == "msg004") {
						message = "价格格式不正确。";
					} else if (data.msg == "locked") {
                        message = "正在提交中或其他人员提交中，请不要连续操作。";
                    }
					$.messager.alert("提示", message, 'warning');
				}
			},
			error : function() {
				$.messager.alert("错误", "系统错误，请联系管理员！", 'error');
				return;
			}
		});
	}
	$(document).ready(function() {
		initList("listDisplay");
	});

</script>
</head>
<body>
	<table width="98%">
		<tr>
			<td>
				<form id="AddFoodForm" name="AddFoodForm" method="post"
					enctype="multipart/form-data">
					<div
						style="height: auto; width: 1180px; background: #fafafa; padding: 5px;"
						class="easyui-panel" title="进货材料价格导入" iconCls="icon-add"
						collapsible="true" minimizable="false" maximizable="false"
						closable="false">
						<table cellpadding="5">
							<tr>

								<td>文件路径</td>
								<td><input class="easyui-filebox" name="filename"
									data-options="required:true"></input></td>
								</td>
								<td><a href="#" style="width:60px;height: 40px;" class="easyui-linkbutton" onclick="excel()">导入</a>
							</tr>

							<input class="easyui-validatebox" type="hidden" name="idList" />
							<input class="easyui-validatebox" type="hidden" name="excelList" />
							<input class="easyui-validatebox" type="hidden" name="footList" />
							<input class="easyui-validatebox" type="hidden" name="supId"
								value="0" />
						</table>
					</div>
				</form>

			</td>
		</tr>
		
	</table>
</body>
</html>